'use strict';

const Controller = require('egg').Controller;
const process = require('child_process');

class HomeController extends Controller {
  async index() {
    process.exec('git pull', (error, stdout, stderr) => {
      console.log(error)
      console.log(stdout)
      if (error !== null) {
        console.log('exec error: ' + error);
        this.ctx.body = error;
      } else {
        this.ctx.body = 'success';
      }
    });

  }
  async index2() {

    this.ctx.body = '111222333';

  }
}

module.exports = HomeController;
